import { createApp } from 'vue'
// import './style.css'
import App from './App.vue'
//引入router
import router from './router'
// 导入api
import api from './api'

const app = createApp(App)
app.use(router) // 挂载路由
// 在实例上绑定属性
app.config.globalProperties.$api = api // 挂载api


router.beforeEach((to, from) => {
  if (to.path !== '/login') {
    if (!localStorage.getItem('h5_token')) {
      return '/login'
    }
  }
})
app.mount('#app')
